<template>
	<!-- 	<view>
		<uv-calendars ref="calendars" mode="range" @confirm="confirm" />
		<button @click="open">打开日历</button>
	</view> -->

	<view class="" style="height:100%;overflow: hidden;background-color: white;">
		<!-- <uv-cell-group v-if="list.length>0">
			<uv-cell v-for="(item, index) in list" :key="index" :label="item.area" :title="item.nickname"
				:value="item.create_at" required="true" @click="goDetail2(item.id)">
			</uv-cell>

		</uv-cell-group> -->

		<uv-cell :center="true" v-for="(item, index) in list" :key="index" v-if="list.length>0">
			<template #title>
				<view>{{item.nickname}}</view>
				<view style="margin-top: 15rpx;">打卡城市:<span style="">{{item.city}}</span></view>
				<view style="margin-top: 15rpx;">打卡地址:<span style="">{{item.area}}</span></view>
				<view style="margin-top: 15rpx;">打卡日期:<span style="">{{item.create_at}}</span></view>
			</template>

		</uv-cell>


		<view v-else style="text-align: center;margin-top: 250rpx;color: lightgray;">暂无数据</view>
	</view>

</template>
<script>
	import config from "@/config/config.js";
	import xcUniappUtils from '@/library/xcore/js/XcUniappUtils.js';
	import xcHttpUtils from '@/library/xcore/js/XcHttpUtils.js';
	import xcViewUtils from '@/library/xcore/js/XcViewUtils.js';
	import xcCloginUtils from '@/library/xcore/js/XcCloginUtils.js';
	import xcCWeixinMpLoginUtils from '@/library/xcore/js/XcCWeixinMpLoginUtils.js';
	import {
		xsStringUtils,
		xsDateUtils,
		xsArrayUtils
	} from 'xstack-for-javascript';

	export default {
		onPageScroll() {
			// 滚动后及时更新位置
			this.$refs.dropDown.init();
		},
		computed: {
			dropItem(name) {
				return (name) => {
					const result = {};
					const find = this.result.find(item => item.name === name);
					if (find) {
						result.label = find.label;
						result.value = find.value;
					} else {
						result.label = this[name].label;
						result.value = this[name].value;
					}
					return result;
				}
			},
			// 获取当前下拉筛选项
			currentDropItem() {
				return this[this.activeName];
			}
		},
		data() {
			return {
				// 表示value等于这些值，就属于默认值
				defaultValue: [0, 'all', '0'],
				// 筛选结果
				result: [{
					name: 'order',
					label: '筛选日期',
					value: '1'
				}],



				user_id: '',
				list: [],
				config: config,
				xsStringUtils: xsStringUtils,
				xsDateUtils: xsDateUtils,
				sp: {
					id: null
				},
				sr: {
					row: [],
					userinfo: null
				},
				control: {}
			}
		},
		onLoad(options) {
			let that = this;
			that.user_id = options.user_id

			console.log(4444, that.user_id)

		},

		onShow() {
			let that = this;
			that.getdata()
		},

		onPullDownRefresh() {
			let that = this;
			setTimeout(function() {
				that.public_show();
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
			open() {
				this.$refs.calendars.open();
			},
			confirm(e) {
				console.log(e)
			},


			getdata() {
				var that = this
				uni.request({
					url: 'https://shanghaihuxi.cn/api/index/getdaka',
					data: {
						user_id: that.user_id,
					},
					header: {
						'Content-Type': 'application/json' // 请求头，可以根据接口要求修改
					},
					success: (res) => {
						console.log(222, res)
						that.list = res.data.data
					}
				});
			},
			goDetail2(id) {
				var id = 18
				uni.navigateTo({
					url: '/pages/csmwj/paper?id=' + id
				});
			},
			control_clickLogin() {

				uni.navigateTo({
					url: '/pages/xclogin/me'
				});
			},
			goDetail(id) {
				console.log(id)
				uni.navigateTo({
					url: '/pages/csmwj/paper?id=' + id
				});
			},
			xinit() {
				let that = this;

			},
			public_show() {
				let that = this;
			},
			public_reset() {
				let that = this;
				that.public_show();
			},
			control_switchLocale(locale) {
				let that = this;
				xcLangUtils.switchLocale(locale);
			}
		}
	}
</script>

<style lang="scss">

</style>